<?xml version="1.0" encoding="UTF-8"?>
<!--
  Created by IntelliJ IDEA.
  User: Nikita.Brazhnikov
  Date: 10/19/12
  Time: 10:15 AM
-->
<!DOCTYPE html
        PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/facelets"
      xmlns:c="http://java.sun.com/jsf/core">

<h:head>
    <title>IGNORED</title>
</h:head>

<h:body>
    <f:component>
        <h:outputStylesheet library="css" name="user_info.css"/>

        <div id="user_panel" class="control_panel #{users.logged ? 'logged' : 'nologged'}">
            <h:outputFormat value="Welcome, {0}" styleClass="greeting">
                <c:param value="#{users.logged ? users.username : 'guest'}"/>
            </h:outputFormat>
            <f:fragment id="user_info" rendered="#{users.logged}">
                <h:panelGrid id="user_info_grid" columns="2" columnClasses="info_table_col1,info_table_col2"
                             styleClass="info_table">
                    <h:outputText value="Last login:"/>
                    <h:outputText value="#{users.lastVisit}"><c:convertDateTime type="both"/></h:outputText>
                    <h:outputText value="Register date:"/>
                    <h:outputText value="#{users.registerDate}"><c:convertDateTime type="date"/></h:outputText>
                </h:panelGrid>
                <h:form>
                    <span id="user_info_ctl_links">
                        <h:commandLink value="Logout" action="#{login.doLogout}"/>
                        <h:link outcome="profile" value="Profile">
                            <c:param name="user" value="#{users.username}"/>
                        </h:link>
                    </span>
                </h:form>
            </f:fragment>
            <f:fragment rendered="#{not users.logged}">
                <h:form>
                    <h:panelGrid columns="2">
                        <h:inputText value="#{login.login}" required="true" requiredMessage="Must not be null"/><br/>
                        <h:commandLink action="#{login.doLogin}" value="Login 'Nikita'"/>
                    </h:panelGrid>
                </h:form>
            </f:fragment>
        </div>
    </f:component>
</h:body>

</html>